﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace HYWJ
{
    public class DataBase
    {
        public static SqlConnection connection = new SqlConnection();
        public static string OpenDataBase()
        {
            string err = "";
            if (!connection.State.ToString().Equals("Open"))
            {
                try
                {
                    string connString = "Data Source=.;Initial Catalog=shenyang;User ID=sa;pwd=123;";
                    connection.ConnectionString = connString;
                    connection.Open();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    err = ex.Message;
                }
            }
            return err;
        }
    }
}
